package com.jmb.api.controller.APITEST.pre;

import com.jmb.api.common.result.Result;
import com.jmb.api.model.entity.ApiTestCase;
import com.jmb.api.service.ApiTestPreCaseService;
import com.jmb.api.vo.api.ApiTestCaseVo;
import com.jmb.api.vo.api.ApiTestPreCaseVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Tag(name = "前置用例")
@RequestMapping("/api/test/pre")
@RestController
public class ApiTestPreCaseController {
    @Autowired
    private ApiTestPreCaseService apiTestPreCaseService;

    @Operation(summary = "保存前置用例")
    @PostMapping("/save")
    public Result save(@RequestBody @Valid ApiTestPreCaseVo apiTestPreCaseVo){
        apiTestPreCaseService.savePreCase(apiTestPreCaseVo);
        return Result.ok();
    }
    @Operation(summary = "编辑前置用例")
    @PostMapping("/edit")
    public Result edit(@RequestBody @Valid ApiTestPreCaseVo apiTestPreCaseVo){
        apiTestPreCaseService.editPreCase(apiTestPreCaseVo);
        return Result.ok();
    }
}
